<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/vue.min.js"></script>
</head>
<body>
    <div id="box">
        <ul>
            <!-- 每当有myValue发生了改变,凡是涉及到myvalue的,都会被重新加载 -->
            <input type="text"  v-model="myValue">
            <!-- 因此test() 会被调用 -->
            <li v-for="(item,index) of test()" :key="index">
                {{item}}
            </li>
        </ul>

        <!-- 里面是可以写函数的 -->
        <!-- {{test()}} -->
    </div>
    <script>
        let vm = new Vue({
            el:"#box",
            data:{
                myValue:'',
                dataArr:['11','22','33','44'] 
                },
                methods: {
                    test(){
                       return this.dataArr.filter(intem=>intem.includes(this.myValue))
                    }
                },
             
        })

       

    </script>
</body>
</html>